﻿create procedure [dbo].[usp_ExceptionInnerExceptionInsert]
	@ExceptionId int
	, @InnerExceptionId int
as

begin try
	
	begin transaction
	
		if not exists(select * from [dbo].[ExceptionInnerException] where [ExceptionId] = @ExceptionId and [InnerExceptionId] = @InnerExceptionId)
		
			begin
										                              
				insert [dbo].[ExceptionInnerException]
				(
					[ExceptionId]
					, [InnerExceptionId]
				)
				values
				(
					@ExceptionId
					, @InnerExceptionId
				)
				
			end
			
	commit transaction

end try
	
begin catch
	if @@trancount > 0
	begin
		rollback transaction;
	end
	execute [dbo].[usp_SqlErrorInsert]
end catch


